package com.chengzhi.structure;

import java.util.Random;

/**
 * @description: 并查集测试
 * @author: ruanchengzhi
 * @create: 2020-03-16 14:15
 **/
public class UnionFindTest {
    public static void main(String[] args) {
        long startTime = System.currentTimeMillis();
        UnionFind unionFind = new UnionFind(10000000);
        Random random = new Random();
        unionFind.union(2, 3);
        for (int i = 0; i < 10000; i++) {
            int t1 = random.nextInt(10000000);
            int t2 = random.nextInt(10000000);
            unionFind.union(t1, t2);
        }
        System.out.println(System.currentTimeMillis() - startTime);
    }
}
